﻿--通讯录
create table ContactDir
(
	ID int		primary key ,
	[Name]		varchar(100) not null,
	UpperID		int not null,
	Path		varchar(100) not null,
	Depth		int not null,
	Orders		int ,
	CreatorID	int not null,
	CreatorName varchar(50),
	InputTime	datetime not null default getdate(),
	Remark		varchar(200)
)
insert into [contactdir] ([ID],[Name],[UpperID],[Path],[Depth],[Orders],[CreatorID],[CreatorName],[InputTime],[Remark]) values  (1,'客户通讯录',0,',',0,1,-1,'系统管理员',getdate(),null);
go
create table Contact
(
	ID			 int primary key ,
	[Name]		 varchar(50) not null,
	DirID		 int foreign key references ContactDir(ID) on delete cascade,
	Headship	 varchar(50),
	Mobile		 varchar(20),
	Email		 varchar(100),
	QQ			 varchar(20),
	MSN			 varchar(100),
	HomeAddr	 varchar(200),
	HomePhone	 varchar(20),
	HomeZip      varchar(8),
	CorpName	 varchar(50),
	CorpSite	 varchar(100),
	WorkPhone	 varchar(20),
	WorkFax		 varchar(20),
	WorkAddr	 varchar(200),
	WorkZip      varchar(8),
	Orders		 int not null default 0,
	Remark		 varchar(500),
	InputTime	 datetime not null default getdate(),
	CreatorID	 int not null,
	CreatorName  varchar(50) not null,
	IsPublic	 bit not null default 1
)
